@echo off
REM Usage:
REM genModel.bat database_name table_name
REM Example:
REM genModel.bat library books
REM Move the generated files from .\genModel to the corresponding service's model directory

REM Table name to generate
set tables=%2
REM Directory to generate model files
set modeldir=..\app\user\model

REM Database configuration
set host=127.0.0.1
set port=3306
set dbname=%1
set username=root
set passwd=mysql

echo Starting to create table: %tables% in database: %dbname%
goctl model mysql datasource -url="%username%:%passwd%@tcp(%host%:%port%)/%dbname%" -table="%tables%" -dir="%modeldir%" -cache=true --style=goZero